package 剑指offer;

import common.ListNode;

/**
 * @author zhangjunfei
 * @date 2023/7/20 17:01
 */
public class O_18 {
    public ListNode deleteNode(ListNode head, int val) {
        ListNode temp = head;
        while (temp != null) {
            if (temp.next.val == val) {
                temp.next = temp.next.next;
                break;
            }
            temp = temp.next;
        }
        head = temp;
        return head;
    }
}
